package com.stox.ui.javafx.core.profile;

import javafx.scene.control.ChoiceBox;
import javafx.util.StringConverter;

import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import com.stox.dto.Profile;

@Component
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public class ProfileChoiceBox extends ChoiceBox<Profile> {

	public ProfileChoiceBox() {
		Profile profile = new Profile();
		getItems().add(profile);
		getSelectionModel().select(0);
		
		setConverter(new StringConverter<Profile>() {
			
			@Override
			public String toString(Profile profile) {
				return profile.getName();
			}
			
			@Override
			public Profile fromString(String arg0) {
				// TODO Auto-generated method stub
				return null;
			}
		});
	}
	
}
